perm filename ALHEAD.PAL[AL,HE]19 blob sn#468742 filedate 1979-08-20 generic text, type C, neo UTF8
COMMENT ⊗   VALID 00005 PAGES
C REC  PAGE   DESCRIPTION
C00001 00001
C00002 00002	.SBTTL  Switches, absolute locations, registers, mark instructions
C00005 00003	Routine calling and defining macros  ROUTINE, CALL
C00008 00004	Macros: PUSH, POP, TELL, INFO, XX, TT, PUTLOC, ALERR, PUNT
C00011 00005	Separate assembly communication facility COMTAB
C00018 ENDMK
C⊗;
.SBTTL  Switches, absolute locations, registers, mark instructions

;This macro gives the switch SW a default value VAL
	.MACRO STSW SW,VAL
	.IFNDF SW
	SW == VAL   ;if do not have a value already, give it one
	.ENDC
	.ENDM



; PROGRAM DEFINITIONS

;  Refer to UNIBUS.BO[11,DOC] for all absolute location meanings

ERRTRP==4		;time out and error trap
ILGINS==10		;illegal instruction
CLKTRP==104		;clock trap
DACVEC==130		;DAC interrupt vector
ADCVEC==134		;ADC interrupt vector
ARMTRP==200		;Arm error interrupt vector
YTRP==314		;Yellow arm panic interupt (channel B)
DDT=130000		;Restart of DDT
PS=177776		;processor status word
VITTS==170777		;Video Intensity Table Table Select
VIT==171000		;Video Intensity Table (400 words long)
KBIS==177560		;keyboard input status
KBIR==177562		;keyboard input register
KBOS==177564		;keyboard output status
KBOR==177566		;keyboard output register
CLKCNT==172544		;clock counter
CLKSET==172542		;clock set register
CLKS==172540		;clock status

HCOR==157776		;highest useable word in core
OREG==274 ;was HCOR	;put something here, 11TTY will print it on console
IREG==272 ;was HCOR-2	;11TTY puts stuff here for console input
OUTSW==270 ;was HCOR-4	;0 => your console; -1 => VT05

;REGISTER DEFINITIONS

PC=%7			;program counter
SP=%6			;stack pointer

RF==%5			;Display pointer
SG==%5			;string pointer
R5=%5

R4=%4			;Saved across procedure calls
R3=%3			;Saved across procedure calls
R2=%2			;Saved across procedure calls
R1=%1			;temp
R0=%0			;temp
AC5==%5			;Temp Floating point register
AC4==%4			; "      "	"      "
AC3==%3			; "      "	"      "
AC2==%2			; "      "	"      "
AC1==%1			; "      "	"      "
AC0==%0			; "      "	"      "

;Routine calling and defining macros  ROUTINE, CALL
;Coded by RHT 9/74. modified to eliminate use of the MARK instruction by ARG 9/77

;This should be used at the start of routines which reference
;	parameters off the RF stack.  It gives the parameters
;	symbolic names for clarity of coding.
;For example,
;
;	ROUTINE FOO,<A,B>
;
;Goes to
;
;	A==4
;	B==2
;FOO:

	.MACRO ROUTINE ID,ARGS
	    .IFNB ARGS
	    NNNN==0
		.IRP II,<ARGS>		;Raise NNNN to twice the number of args.
		     NNNN==NNNN+2
		.ENDM
		.IRP II,<ARGS>		;Assign each arg NNNN and decrease same.
		    .IFDF II
			 .IF1 
			      .ERROR Multiple definition for II
			 .ENDC
		    .ENDC
		     II == NNNN
		     NNNN == NNNN-2
		.ENDM
	   .ENDC
ID:
	.ENDM

;This is useful in calling rountines which reference parameters off
;	the RF stack.  It sets up the stack properly, but does not
;	save R0 or R1.

	.MACRO CALL ID,ARGS
	   .IFNB ARGS
		nn == 0
		.IRP II,<ARGS>
		MOV II,-(SP)	;Push an argument
		nn == nn + 2	;Keep track of how many words we've pushed
		.ENDM
		MOV RF,-(SP)	;Save RF
		MOV SP,RF	;Set up the display in RF.
	   .ENDC
	JSR PC,ID		;Call the routine
	   .IFNB ARGS
		MOV (SP)+,RF	;Restore RF
		ADD #nn,SP	;Pop args off of stack
	   .ENDC
	.ENDM

;This macro is a temporary method of defining floating point
;constants. LABIL is the constant name and MSB and LSB its two
;16 bit octal parts.

       .MACRO FP  LABIL,MSB,LSB
	.MACRO  LABIL
	 	.WORD	MSB,LSB	
	.ENDM
       .ENDM

;Macros: PUSH, POP, TELL, INFO, XX, TT, PUTLOC, ALERR, PUNT

.MACRO	PUSH X
	.IRP Y,<X>
	MOV Y,-(SP)
	.ENDM
	.ENDM

.MACRO	POP X
	.IRP Y,<X>
	MOV (SP)+,Y
	.ENDM
	.ENDM

	.MACRO TELL VAR
		TELL2 VAR,\VAR
	.ENDM

	.MACRO TELL2 S,V
		.PRINT /S = /
		.PRINT /V
/
	.ENDM

	 .MACRO .INFO STR,NUM
		  .PRINT /STR/
		  .PRINT /NUM
/
	 .ENDM

	.MACRO	XX SYM			;Just gives SYM the next number.
	   .IFDF SYM
	     .IFNZ SYM-II
		.IF1
		.ERROR You are using SYM in two ways!!!
		.ENDC
	     .ENDC
	   .ENDC
	    SYM == II
	    II == II+2
	.ENDM

	.MACRO TT INX,VAL		;To store data at an offset from II
	 .=II+INX
	 VAL
	.ENDM

	.MACRO PUTLOC   ADR,VAL
	 II==.
	 .= ADR
	 VAL
	.=II
	.ENDM

	.MACRO ALERR MES	;Bad error.  Type message, call debugger.
	MOV #MES,-(SP)		;Push the message pointer.
	JSR PC,@LERRTRAP	;No need to save registers.  This is done in ERRTRAP.
	.ENDM

	.MACRO PUNT MES		;Real bad error.  Type message, call debugger.
	MOV #MES,-(SP)		;Push the message pointer.
	JSR PC,@LERRTRAP	;No need to save registers.  This is done in ERRTRAP.
	MOV #PNTMES,-(SP)	;Push the "Can't continue" message pointer.
	JSR PC,@LERRTRAP	;No need to save registers.  This is done in ERRTRAP.
	BR .-10			;Loop forever or until he gives up
	.ENDM

SPSWITCH == 0	;0 => code, 1 => data

	.MACRO CODE     ;The following is code, it should go in instruction space
	.IFNZ SPSWITCH
	DATA$ == .
	.OFFSET -340000		;For code virtual 0 → physical 340 000
	. == CODE$
	SPSWITCH == 0
	.ENDC
	.ENDM

	.MACRO DATA     ;The following is data, it should go in data space
	.IFZ SPSWITCH
	CODE$ == .
	.OFFSET -160000		;For data virtual 0 → physical 160 000
	. == DATA$		;Change MAP_OFFSET in ALAID.SAI if offset is changed
	SPSWITCH == 1
	.ENDC
	.ENDM

;Separate assembly communication facility COMTAB

COMMENT  ⊗  All locations local to one assembly which need
to be known to the others are listed here. They are all virtual addresses. ⊗

COMTAB == 0		;Communication table (256 words)
IPATCH == 0		;Code Space Patch area (256 words)
START == 1000		;Kernel initialization address (physical address)
INIT  == 1004		;Kernel initialization address (physical address)
DPATCH == 1000		;Data Space Patch area (256 words)
ARMCOD == 1006		;Beginning of the arm code		(11.5K)
ARMDAT == 2000		;Beginning of the arm code data space	( 7.5K)
INTCOD == 60000		;Beginning of the interpeter code	(12.0K)
INTDAT == 50000		;Beginning of the interpeter data space	( 8.0K)
PCODE = 100000		;Pseudo-code start address		(12.0K)

;The following is the COMTAB.  It has room for =128 labels.

;_____________________________________________________________
 VERSION == 20		;Change this if you change COMTAB!!! |
--------------------------------------------------------------

. = COMTAB

NOTB10::.BLKW 20	;Used by ALAID to talk to the 10  (Phys. addr: 160 000)
NOTB11::.BLKW 20	;				  (Phys. addr: 160 040)


HIADDR::.WORD 0		;Where the pcode ends.
ARMVER::.WORD 0		;What the arm code thinks VERSION is.
PCDVER::.WORD 0		;What the pcode thinks PCVERSION is.

			;Entry in GRAPHS.PAL[AL,HE]
LGETVAL::.WORD 0		;Routine for searching graph structure
LINVLDT::.WORD 0		;Invalidates graph node

			;Entry in INTERP.PAL[AL,HE]
LGETARG::.WORD 0		;Finds place in environment for level-offset

			;Entry in ALIO.PAL[AL,HE]
LERRTRAP::.WORD 0		;Call this to print an error message.

			;The follow entry points are located in ARM.PAL[AL,HE]
LINTARM::.WORD 0	;Arm initialization
LCENTER::.WORD 0	;Center routine
LWHERE:: .WORD 0	;Where routine
LMOVE::	.WORD 0		;Move routine
LOPERATE::.WORD 0	;Operate routine
LERRPTR::.WORD 0	;All error torques:  indirect table
LTHPTR::.WORD 0		;All theta:  joint angle indirect table
LDVCPTR::.WORD 0	;Device block ptrs for attached servos
LSETBAS::.WORD 0	;Force wrist set base routine
LWRIST::.WORD 0		;Force wrist resolving routine
LSETC::	.WORD 0		;Force sensing and compliance system initialization
LFRCSIG::.WORD 0	;Initializes job starting, based upon a force reading
LFRCOFF::.WORD 0	;Takes a queued job off of the force signal list
LCOMPLY::.WORD 0	;Sets up force compliance of a given magnitude and direction
LCMPOFF::.WORD 0	;Turns off force compliance in a specified direction
LPOTPTR::.WORD 0	;Addresses for pot readings
LSETSTF::.WORD 0	;Sets up stiffness of arm for next motion
LGATHER::.WORD 0	;Gathers forces sensed by wrist during motion

			;The follow entry points are located in ARITH.PAL[AL,HE]
LSQRTF::.WORD 0		;Square root routine
LEXP::	.WORD 0		;Raise e to a power routine
LLOG::	.WORD 0		;Natural Log routine
LSNCSD::.WORD 0		;Sin&Cos routine (degrees)
LASIN::	.WORD 0		;Asin routine (degrees)
LACOS::	.WORD 0		;Acos routine (degrees)
LATAN2::.WORD 0		;Atan2 routine (degrees)

			;The follow entry points are located in ARMSOL.PAL[AL,HE]
LUPDATE::.WORD 0	;Arm solution to go from joint angles to transform


			;The following entry point is located in EULER.PAL
LEULER::.WORD 0		;Get the Euler angle

			;The following entry points are located in PARM.PAL[PNT,HE]
			;for auxilliary move commands
			; which compute the polynomials at runtime
LRPMOVE::.WORD 0	;POINTY move command located in tmove3.pal
LRTADRIVE::.WORD 0	;drive instructions to absolute joint pos
LRTDDRIVE::.WORD 0	;incremental joint motion
LRCENTER::.WORD 0	;center 
LRFORCE::.WORD	0	;returns force values to the 10

COMMENT ⊗
If you want to define where, say, DRIVE is, you should do this:
	PUTLOC LDRIVE, DRIVE
If you want to call, say, GETVAL, you should do this:
	JSR PC,@LGETVAL
⊗